package leecode

func findKthPositive(arr []int, k int) int {
	index := 1
	losArr := make([]int, 0, k)
	i := 0
	x := 0
	for len(losArr) < k {
		if len(arr) <= i {
			return index + k - 1 - x
		}
		if arr[i] != index {
			losArr = append(losArr, index)
			x++
		} else {
			i++
		}
		index++
	}
	return losArr[k-1]
}
